package org.example.common.config;

import lombok.Data;
import org.example.enums.BaseErrorEnums;

@Data
public class BaseErrorException extends RuntimeException{

    private Integer code;

    private String msg;


    public BaseErrorException(String msg,Integer code){
        super(msg);
        this.code = code;
        this.msg = msg;
    }


    public BaseErrorException(String msg){
        super(msg);
        this.code = 500;
        this.msg = msg;
    }

    public BaseErrorException(BaseErrorEnums baseErrorEnums){
        super(baseErrorEnums.getMsg());
        this.code = baseErrorEnums.getCode();
        this.msg = baseErrorEnums.getMsg();
    }

}
